package com.matt.foundation.vo;

import com.matt.foundation.utils.DateUtil;
import lombok.Data;

import java.util.Date;
import java.util.Objects;

/**
 * *******************************
 * Created by Ron.
 * form com.matt
 * on 2017/9/22
 * *******************************
 */
@Data
public class BirthdayRecordPageVo {

    private String id;

    private String title;

    private String content;

    private String[] resourceUrl;

    private String teacherName;

    private String created;


    public static BirthdayRecordPageVo of(Object[] objects) {
        BirthdayRecordPageVo vo = new BirthdayRecordPageVo();
        vo.setId(objects[0] == null ? "" : objects[0].toString());
        vo.setTitle(objects[1] == null ? "" : objects[1].toString());
        vo.setContent(objects[2] == null ? "" : objects[2].toString());
        if (Objects.nonNull(objects[3]))
            vo.setResourceUrl(objects[3].toString().split("\\|"));
        vo.setTeacherName(objects[4] == null ? "" : objects[4].toString());
        vo.setCreated(DateUtil.millisToDateTime(((Date)objects[5]).getTime(), "yyyy-MM-dd"));
        return vo;
    }
}
